Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Allow const assertions in no-object-literal-type-assertion #4681

Merged
merged 4 commits into from
May 7, 2019

Conversation

asmundg
Copy link
Contributor

@asmundg asmundg commented Apr 24, 2019

These are not normal type assertions and asserting that literal objects
are immutable is a normal usage pattern.

PR checklist

Overview of change:

Allow const assertions in no-object-literal-type-assertion. These are not equivalent to normal type assertions, and using them on literal objects is expected behavior.

Is there anything you'd like reviewers to focus on?

CHANGELOG.md entry:

[enhancement] Allow const assertions in no-object-literal-type-assertion

These are not normal type assertions and asserting that literal objects
are immutable is a normal usage pattern.
@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @asmundg! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @asmundg, thanks for sending this PR! Before reviewing rule changes we'll need to see tests that exercise the changed behavior.

@asmundg
Copy link
Contributor Author

asmundg commented Apr 25, 2019

@JoshuaKGoldberg this relies on a new utility function added in typescript 3.4. Is it reasonable to bump tslint's typescript dev dependency?

@asmundg
Copy link
Contributor Author

asmundg commented May 7, 2019

@JoshuaKGoldberg thanks for the input, I've addressed your change requests.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@JoshuaKGoldberg JoshuaKGoldberg merged commit d79cd18 into palantir:master May 7, 2019
@adidahiya adidahiya mentioned this pull request May 30, 2019
@asmundg asmundg deleted the asmundg/allow-const-assert branch June 18, 2019 08:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no-object-literal-type-assertion should have an option to allow const assertions
3 participants